function href_add_friend() {
	usr_input = document.getElementById("new_friend_name");
	if( usr_input != null ) {
		if( usr_input.value.length > 5 ) {
			param = new Object();
			param.name =  "friendname";
			param.value = usr_input.value;
			http_post("add_friend.php", param);
		}else{
			alert("Username must be at least 6 characters long.");
		}
	}
}

function href_del_friend() {
	fid = document.getElementById("del_fid");
	if( fid != null ) {
		param = new Object();
		param.name =  "fid";
		param.value = fid.value;
		http_post("del_friend.php", param);
	}
}

function http_post(url, param) {
    var form = document.createElement('form');
    form.action = url;
    form.method = 'POST';
	
	var input = document.createElement('input');
	input.type = 'hidden';
	input.name = param.name;
	input.value = param.value;
	form.appendChild(input);
	
	document.body.appendChild(form);
    form.submit();
}

function hide_prompt(prompt_id) {
	div = document.getElementById(prompt_id);
	if( div != null ) {
		div.style.display = "none";
	}
}

function show_prompt(prompt_id) {
	div = document.getElementById(prompt_id);
	if( div != null ) {
		div.style.display = "block";
	}
}

function start_conv(uid) {
	window.open('conversation.php?fuid='+uid, 'conversation', 'status=yes,height=430,width=520', false);
}

function show_log(uid) {
	window.open('log.php?fuid='+uid, 'log', 'status=yes,height=500,width=540', false);
}
